// import com.alibaba.druid.DbType;
// import com.alibaba.druid.sql.ast.*;
// import com.alibaba.druid.sql.ast.statement.SQLCreateIndexStatement;
// import com.alibaba.druid.sql.ast.statement.SQLCreateStatement;
// import com.alibaba.druid.sql.dialect.oracle.ast.OracleSegmentAttributes;
// import com.alibaba.druid.sql.dialect.oracle.visitor.OracleASTVisitor;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

// import java.util.ArrayList;
// import java.util.List;
#include "OracleCreateIndexStatement.h"
#include "../../../../../DbType.h"
#include "../../visitor/OracleASTVisitor.h"
#include "../../../../visitor/SQLASTVisitor.h"
#include "../../../../../utils/listTran.h"
#include "../../../../ast/statement/SQLTableSource.h"

OracleCreateIndexStatement::OracleCreateIndexStatement()
    : SQLCreateIndexStatement(DbType_ptr(new DbType(&DbType::oracle)))
{
  localStoreIn = std::make_shared<std::list<SQLName_ptr>>();
  localPartitions = std::make_shared<std::list<SQLPartition_ptr>>();
  globalPartitions = std::make_shared<std::list<SQLPartitionBy_ptr>>();
}

SQLExpr_ptr OracleCreateIndexStatement::getParallel()
{
  return parallel;
}

void OracleCreateIndexStatement::setParallel(SQLExpr_ptr parallel)
{
  this->parallel = parallel;
}

BOOL_ptr OracleCreateIndexStatement::isNoParallel()
{
  return noParallel;
}

void OracleCreateIndexStatement::setNoParallel(BOOL_ptr noParallel)
{
  this->noParallel = noParallel;
}

BOOL_ptr OracleCreateIndexStatement::isIndexOnlyTopLevel()
{
  return indexOnlyTopLevel;
}

void OracleCreateIndexStatement::setIndexOnlyTopLevel(BOOL_ptr indexOnlyTopLevel)
{
  this->indexOnlyTopLevel = indexOnlyTopLevel;
}

BOOL_ptr OracleCreateIndexStatement::getSort()
{
  return sort;
}

void OracleCreateIndexStatement::setSort(BOOL_ptr sort)
{
  this->sort = sort;
}

BOOL_ptr OracleCreateIndexStatement::isReverse()
{
  return reverse;
}

void OracleCreateIndexStatement::setReverse(BOOL_ptr reverse)
{
  this->reverse = reverse;
}

void OracleCreateIndexStatement::accept0(SQLASTVisitor_ptr visitor)
{
  accept0(std::dynamic_pointer_cast<OracleASTVisitor>(visitor));
}

// @Override
void OracleCreateIndexStatement::accept0(OracleASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(OracleCreateIndexStatement)))
  {
    acceptChild(visitor, getName());
    acceptChild(visitor, getTable());
    SQLObject_list_ptr tmp1 = ListTran::tran_class<SQLSelectOrderByItem, SQLObject>(getItems());
    acceptChild(visitor, tmp1);
    acceptChild(visitor, getTablespace());
    acceptChild(visitor, parallel);
  }
  visitor->endVisit(SharedObject(OracleCreateIndexStatement));
}

BOOL_ptr OracleCreateIndexStatement::getEnable()
{
  return enable;
}

void OracleCreateIndexStatement::setEnable(BOOL_ptr enable)
{
  this->enable = enable;
}

BOOL_ptr OracleCreateIndexStatement::isComputeStatistics()
{
  return computeStatistics;
}

void OracleCreateIndexStatement::setComputeStatistics(BOOL_ptr computeStatistics)
{
  this->computeStatistics = computeStatistics;
}

BOOL_ptr OracleCreateIndexStatement::isOnline()
{
  return online;
}

void OracleCreateIndexStatement::setOnline(BOOL_ptr online)
{
  this->online = online;
}

BOOL_ptr OracleCreateIndexStatement::isCluster()
{
  return cluster;
}

void OracleCreateIndexStatement::setCluster(BOOL_ptr cluster)
{
  this->cluster = cluster;
}

//////////////

SQLName_ptr OracleCreateIndexStatement::getTablespace()
{
  return tablespace;
}

void OracleCreateIndexStatement::setTablespace(SQLName_ptr tablespace)
{
  if (tablespace != nullptr)
  {
    tablespace->setParent(SharedObject(OracleCreateIndexStatement));
  }
  this->tablespace = tablespace;
}

BOOL_ptr OracleCreateIndexStatement::getCompress()
{
  return compress;
}

void OracleCreateIndexStatement::setCompress(BOOL_ptr compress)
{
  this->compress = compress;
}

int OracleCreateIndexStatement::getCompressLevel()
{
  return compressLevel;
}

void OracleCreateIndexStatement::setCompressLevel(int compressLevel)
{
  this->compressLevel = compressLevel;
}

int OracleCreateIndexStatement::getPctthreshold()
{
  return pctthreshold;
}

void OracleCreateIndexStatement::setPctthreshold(int pctthreshold)
{
  this->pctthreshold = pctthreshold;
}

int OracleCreateIndexStatement::getPctfree()
{
  return pctfree;
}

void OracleCreateIndexStatement::setPctfree(int ptcfree)
{
  this->pctfree = ptcfree;
}

int OracleCreateIndexStatement::getPctused()
{
  return pctused;
}

void OracleCreateIndexStatement::setPctused(int ptcused)
{
  this->pctused = ptcused;
}

int OracleCreateIndexStatement::getInitrans()
{
  return initrans;
}

void OracleCreateIndexStatement::setInitrans(int initrans)
{
  this->initrans = initrans;
}

int OracleCreateIndexStatement::getMaxtrans()
{
  return maxtrans;
}

void OracleCreateIndexStatement::setMaxtrans(int maxtrans)
{
  this->maxtrans = maxtrans;
}

int OracleCreateIndexStatement::getPctincrease()
{
  return pctincrease;
}

void OracleCreateIndexStatement::setPctincrease(int pctincrease)
{
  this->pctincrease = pctincrease;
}

int OracleCreateIndexStatement::getFreeLists()
{
  return freeLists;
}

void OracleCreateIndexStatement::setFreeLists(int freeLists)
{
  this->freeLists = freeLists;
}

BOOL_ptr OracleCreateIndexStatement::getLogging()
{
  return logging;
}

void OracleCreateIndexStatement::setLogging(BOOL_ptr logging)
{
  this->logging = logging;
}

SQLObject_ptr OracleCreateIndexStatement::getStorage()
{
  return storage;
}

void OracleCreateIndexStatement::setStorage(SQLObject_ptr storage)
{
  this->storage = storage;
}

BOOL_ptr OracleCreateIndexStatement::isCompressForOltp()
{
  return compressForOltp;
}

void OracleCreateIndexStatement::setCompressForOltp(BOOL_ptr compressForOltp)
{
  this->compressForOltp = compressForOltp;
}

SQLPartition_list_ptr OracleCreateIndexStatement::getLocalPartitions()
{
  return localPartitions;
}

BOOL_ptr OracleCreateIndexStatement::isLocal()
{
  return local;
}

void OracleCreateIndexStatement::setLocal(BOOL_ptr local)
{
  this->local = local;
}

SQLName_list_ptr OracleCreateIndexStatement::getLocalStoreIn()
{
  return localStoreIn;
}

SQLPartitionBy_list_ptr OracleCreateIndexStatement::getGlobalPartitions()
{
  return globalPartitions;
}

BOOL_ptr OracleCreateIndexStatement::isGlobal()
{
  return global;
}

void OracleCreateIndexStatement::setGlobal(BOOL_ptr global)
{
  this->global = global;
}
